/* Lab 1, exercise 7
刘文骏 2023.7.7
*/
#include <system.h>

void main() {
    trisb = 0;      // set all bits in port B as outputs
    adcon1 = 0x06;  // set port A as digital inputs
    while (1) {
        if ((porta & 0x10) != 0) {
            portb = porta;  // copy the switches to the LEDs
        } else if ((porta & 1) != 0) {
            portb = 0xff;  // put all LEDs on
        } else {
            portb = 0;  // put all LEDs off
        }
    }
}